import java.util.Arrays;

public class Binary {
    public static void MyBubble(int[] array){
        //确定趟数，同时也是已排序的个数
        for(int i=0;i< array.length-1;i++){
            for(int j=0;j< array.length-1-i;j++){
                if(array[j]>array[j+1]){
                    int tmp=array[j+1];
                    array[j+1]=array[j];
                    array[j]=tmp;
                }
            }
        }
    }
    public static int Find(int[] array,int key){
        int left=0;
        int right=array.length-1;
        while(left<=right){
            int mid=(left+right)/2;
            if(array[mid]==key){
                return mid;
            }else if(array[mid]>key){
                right=mid-1;
            }else{
                left=mid+1;
            }
        }
        return -1;
    }
    public static void main(String[] args) {
        int[] array=new int[]{1,3,2,77,0};
        //MyBubble(array);
        Arrays.sort(array);
        for(int x:array){
            System.out.print(x+" ");
        }
        System.out.println();
        int ret= Arrays.binarySearch(array,2);
        System.out.println(ret);
    }
}
